package com.ideaction.game.globalconst;

import java.util.HashMap;

import com.ideaction.game.utils.JsonUtils;
import com.ideaction.game.utils.Localization;


public abstract class AbstractResult extends HashMap<String, Object>{

	//通用返回key 回退数据
	private String BACKPLAYER = "BackPlayer";
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public boolean isOk() {
		return get("Result") == null ? false : (boolean) get("Result");
	}
	public String response() {
		String jsonStr = JsonUtils.toJson(this);
		return jsonStr;
	}

	public String error(String key,String language) {
		put("Result",false);
		put("Notice", Localization.getInstance().get(key,language));
		return JsonUtils.toJson(this);
	}
	public String toJsonString(){
		return JsonUtils.toJson(this);
	}
}
